<template>
  <div class="app-container">

    <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
      <el-form-item label="交易单号" prop="code">
        <el-input v-model="queryParams.code" placeholder="请输入单号" clearable size="small"/>
      </el-form-item>
      <el-form-item label="用户昵称" prop="accountName">
        <el-input v-model="queryParams.accountName" placeholder="请输入提现账号" clearable size="small"/>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
      </el-form-item>
    </el-form>

    <el-table v-loading="loading" :data="dataList">
      <el-table-column label="交易单号" align="center" prop="code" />
      <el-table-column label="交易时间" align="center" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="用户ID" align="center" prop="accountName" />
      <el-table-column label="用户昵称" align="center" prop="accountName" />
      <el-table-column label="猫粮变化" align="center" prop="accountName" />
      <el-table-column label="变化事项" align="center" prop="accountName" />
      <el-table-column label="剩余宠爱值" align="center" prop="leftoverFavor" />
      <el-table-column label="猫粮余额" align="center" prop="leftoverFavor" />
    </el-table>
    
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
import { listUserApplyWithdraw } from "@/api/system/userApplyWithdraw";

export default {
  data() {
    return {
      // 遮罩层
      loading: true,
      total: 0,
      // 用户提现申请表格数据
      dataList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        code: undefined,
        accountName: undefined,
        rate: undefined,
        channel: undefined,
        status: undefined,
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询用户提现申请列表 */
    getList() {
      this.loading = true;
      listUserApplyWithdraw(this.queryParams).then(response => {
        this.dataList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    }
  }
};
</script>